#pragma once
#ifndef LOGIC_USER_BASE_H
#define LOGIC_USER_BASE_H

#include <vector>
#include <string>

#include "ProtoInc.h"
#include "mysqlutil.h"
#include "DataBrickClient.h"

using namespace std;

class LogicUserBase
{
private:
	static LogicUserBase * plogic;

	LogicUserBase();

	~LogicUserBase();
public:
	static LogicUserBase * GetInstance();

	int GetBase(const char * openid, DataBase & base);

	int GetBase(unsigned uid, DataBase & base);

	int GetBaseLimit(unsigned uid, DataBase & base);

	int ReplaceIntoBase(DataBase & base);

	//根据分数
	int UpdateBaseLimit(DataBase & base);

private:
	bool Init();

	void SetBase(vector<string> & dbdata, DataBase & base);

	void SetBaseLimit(vector<string> & dbdata, DataBase & base);
private:
	MysqlUtil * mysqlutil;
};

#endif  //LOGIC_USER_BASE_H
